<!-- 影院组件 -->
<template>
  <div class="mv-container">
    <main>
      <header>猫眼电影</header>
      <div class="mv-city" @click="goToCityPicker">
        {{ cityName }} <i class="iconfont icon-xiajiantou"></i>
      </div>
      <div class="border"></div>
      <van-tabs v-model="activeName">
        <van-tab title="热门影院">
          <van-dropdown-menu>
            <van-dropdown-item v-model="value1" :options="option1" />
            <van-dropdown-item v-model="value2" :options="option2" />
            <van-dropdown-item v-model="value3" :options="option3" />
          </van-dropdown-menu>
          <!-- <TheaterBody type="hot">
            <template #default="{ list }">
              <HotTheater :list="list"></HotTheater>
            </template>
          </TheaterBody> -->
          <TheaterData> </TheaterData>
        </van-tab>
      </van-tabs>
      <div class="search"  @click="goToSearch">
        <i class="iconfont icon-sousuo"></i>
      </div>
    </main>
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';
import Vue from "vue";
import { Tabs, Tab } from "vant";
import TheaterBody from "@/components/TheaterBody.vue";
import HotTheater from "@/views/home/theaters/HotTheater.vue";
import TheaterData from "@/components/TheaterData.vue";
import { DropdownMenu, DropdownItem } from "vant";

Vue.use(DropdownMenu);
Vue.use(DropdownItem);

Vue.use(Tabs);
Vue.use(Tab);

export default {
  //import引入的组件需要注入到对象中才能使用
  components: {
    TheaterBody,
    HotTheater,
    TheaterData,
  },
  data() {
    //这里存放数据
    return {
      activeName: 1,
      value1: 0,
      value2: "brand",
      value3: "feature",
      option1: [
        { text: "全城", value: 0 },
        { text: "天河", value: 1 },
        { text: "海珠", value: 2 },
        { text: "越秀", value: 3 },
        { text: "荔湾", value: 4 },
        { text: "黄埔", value: 5 },
        { text: "白云", value: 6 },
        { text: "番禺", value: 7 },
        { text: "增城", value: 8 },
        { text: "花都", value: 9 },
        { text: "从化", value: 10 },
        { text: "南沙", value: 11 },
      ],
      option2: [
        { text: "品牌", value: "brand" },
        { text: "万达影城", value: "wd" },
        { text: "大地影院", value: "dd" },
      ],
      option3: [
        { text: "特色", value: "feature" },
        { text: "可改签", value: "gq" },
        { text: "可退票", value: "tp" },
      ],
    };
  },
  //监听属性 类似于data概念
  computed: {
    cityName: function () {
      return localStorage.getItem("cityName") || "广州";
    },
  },
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    goToCityPicker: function () {
      this.$router.push("/citypicker2");
    },
    goToSearch: function () {
      this.$router.push("/search2");
    },
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {},
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
};
</script>
<style lang='less' scoped>
@import url("@/assets/border.less");
.mv-container {
  header {
    height: 0.45rem;
    line-height: 0.45rem;
    background-color: #e54847;
    color: white;
    text-align: center;
    font-size: 0.16rem;
    font-weight: bold;
  }
  main {
    position: relative;
    .mv-city {
      position: absolute;
      z-index: 999;
      left: 0.6rem;
      height: 0.45rem;
      display: flex;
      align-items: center;
      i.iconfont.icon-xiajiantou {
        font-size: 0.12rem;
        margin-left: 0.02rem;
      }
    }
    .border {
      position: absolute !important;
      width: 100%;
      height: 0.45rem;
      .border-1px(0 0 1px 0);
    }
    .search {
      display: flex;
      align-items: center;
      justify-content: center;
      position: absolute !important;
      top: 0.45rem;
      bottom: 0;
      right: 0;
      height: 0.45rem;
      width: 0.45rem;
      .border-1px(0 0 0 1px);
      i.iconfont.icon-sousuo {
        font-size: 0.2rem;
        color: #e54847;
        font-weight: bold;
      }
    }
  }
}
</style>
